Random = Mock.Random

function getCarouselRes(){
    let data = []

    for(let i = 0; i < 3; i++){
        data.push(Mock.mock({
            id : Random.integer(1,100),
            image: Random.image()
        }))
    }

    return {
        data,
        code : 200,
        msg : '获取成功'
    }
}

function delCarousel(){
    return {
        'code' : 200,
        'msg' : '删除成功'
    }
}


function changeCarousel(){
    return {
        'code' : 200,
        'msg' : '修改成功'
    }
}

function addCarousel(){
    return {
        'code' : 200,
        'msg' : '上传成功'
    }
}

function uploadRes(){
    let json = Mock.mock({
        code : 200,
        data : Random.image(),
        msg: '上传成功'
    })

    return json
}

Mock.mock('http://localhost/carousel.php', 'get', getCarouselRes)

Mock.mock('http://localhost/del_carousel.php', 'post', delCarousel)

Mock.mock('http://localhost/add_carousel.php', 'post', addCarousel)

Mock.mock('http://localhost/upload.php', 'post', uploadRes)

Mock.mock('http://localhost/change_carousel.php', 'post', changeCarousel)
